--region *.lua
--Date
--此文件由[BabeLua]插件自动生成

local Packet = require(SCRIPTS_DIR .. ".network.Packet")
local Player = class("Player")
function Player:ctor()
    self.uid = 0
    self.nickname = ""
    self.headimgurl = ""
    self.sex = ""
    self.seat = -1
    self.prop = {}
    self.property = {}
end

function Player:init(uid,seat,photo,nickname,sex,prop,property)
    self.uid = uid
    self.seat = seat
    self.headimgurl = photo
    self.nickname = nickname
    self.sex = sex
    self.prop = json.decode(prop)
    self.property = json.decode(property)
    dump(self.prop)
    dump(self.property)
end

function Player:getUid()
    return self.uid
end

function Player:getSeat()
    return self.seat
end

function Player:getHeadImgUrl()
    return self.headimgurl
end

function Player:getNickName()
    return self.nickname
end

function Player:getSex()
    return self.sex
end

function Player:getSeat()
    return self.seat
end


local BattleData = class("BattleData");
function BattleData:ctor()
    self.otherUsers = {}
end

function BattleData:createUser(uid,seat,photo,nickname,sex,prop,property)
    local player = Player.new()
    player:init(uid,seat,photo,nickname,sex,prop,property)
    self.otherUsers[uid] = player
end

function BattleData:getOtherUsers()
    return self.otherUsers
end


function BattleData:parseXiPai(data)
    local bankerSeat = data:pReadUint8()
    mgrs.log:printDebug("parseXiPai bankerSeat=%d",bankerSeat)
end

function BattleData:parseFaPai(data)
    local rand1 = data:pReadUint16()
    local rand2 = data:pReadUint16()
    local cards = data:pReadShortString()
    mgrs.log:printDebug("rand1=%d rand2=%d cards=%s",rand1,rand2,cards)
end

function BattleData:sendPlayCard()
    local pack = Packet.new();
    pack:initWrite()
    pack:pWriteUint16(101);
    pack:pWriteUint16(2);
    pack:pWriteEnd();
    mgrs.proto:send(pack:getPack(),enums.Socket.Game);
end

return BattleData;
--endregion
